package com.example.project.service.impl;

import com.example.project.dao.IBussinesstripDao;
import com.example.project.entity.Attendance;
import com.example.project.entity.Bussinesstrip;
import com.example.project.service.IBussinesstripService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BussinesstripServiceImpl implements IBussinesstripService {
    @Autowired
    private IBussinesstripDao bussinesstripDao;

    //实现出差信息添加方法
    @Override
    public int add(Bussinesstrip bussinesstrip) {
        return bussinesstripDao.add(bussinesstrip);
    }

    //实现查询所有数据的方法
    @Override
    public List<Bussinesstrip> getAllBussinesstrip(Bussinesstrip bussinesstrip) {
        return bussinesstripDao.getAllBussinesstrip(bussinesstrip);
    }

    //实现删除打卡数据的删除方法
    @Override
    public int deleteBussinesstrip(Bussinesstrip bussinesstrip) {
        int bussinesstripValue=0;
        if (bussinesstrip.getTripId()!=0){
            bussinesstripValue=bussinesstripDao.deleteBussinesstrip(bussinesstrip);
        }
        return bussinesstripValue;
    }

    //实现打卡信息的更新
    @Override
    public int updateBussinesstrip(Bussinesstrip bussinesstrip) {
        int  bussinesstripValue=0;
        if (bussinesstrip.getTripId()!=0){
            bussinesstripValue=bussinesstripDao.updateBussinesstrip(bussinesstrip);
        }
        return  bussinesstripValue;
    }

    //实现单挑查询打卡数据方法
    @Override
    public Bussinesstrip getBussinesstrip(Bussinesstrip bussinesstrip) {
        Bussinesstrip bussinesstrip1=new Bussinesstrip();
        if(bussinesstrip.getTripId()!=0){
            bussinesstrip1=bussinesstripDao.getBussinesstrip(bussinesstrip);
        }
        return bussinesstrip1;
    }
}
